package ForthQuestion;

import java.util.List;
import java.util.ListIterator;

/**
 * @author cyt
 * @date 2020/6/14
 */
public class DeleteStudent {
    //根据学号删除学生
    public static boolean deleteStudent(List<Student> students, int studentNum){
        ListIterator listIterator = students.listIterator();
        while (listIterator.hasNext()){
            Student temp = (Student) listIterator.next();
                if(temp.getStudentNum() == studentNum){
                    listIterator.remove();
            }
        }
        return true;
    }
}
